﻿@inject IStringLocalizer<CheckboxListEnum> Localizer

<div class="row g-3">
    <div class="col-12">
        <CheckboxList @bind-Value="@SelectedEnumValues" ShowLabel="true" DisplayText="@Localizer[nameof(Foo.Name)]" />
    </div>
    <div class="col-12">
        <label class="form-label">@Localizer["Foo.BindValue"]</label>
        <div class="form-control">@(string.Join(",", SelectedEnumValues))</div>
    </div>
</div>

@code {
    private IEnumerable<EnumEducation> SelectedEnumValues { get; set; } = new List<EnumEducation>
    {
        EnumEducation.Middle, EnumEducation.Primary
    };

    enum EnumEducation
    {
        [Display(Name = "小学")]
        Primary,
        [Display(Name = "中学")]
        Middle
    }
}
